import demo.Student;
import demo.Teacher;
import demo.things.TestPaper;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;

public class Application {
    public static void main(String[] args) {
//        BeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource("spring-config.xml"));
//        Student student = (Student) beanFactory.getBean("student");
//        student.sayHi();

        ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
        Student student = context.getBean("student", Student.class);
//        Teacher teacher = context.getBean("teacher", Teacher.class);
//        teacher.setTestPaper("math", 120);
//        TestPaper testPaper = context.getBean("testPaper1", TestPaper.class);
        student.sayHi();
        student.getTestPaper();
    }
}
